import React from "react";
import 'antd/dist/antd.css';
import "./index.css"
import { Form,InputNumber,Input,Table, Tag, Space ,Button,Popconfirm,Alert} from 'antd';
import 'antd/dist/antd.css';
import axios from "axios";
import {EditOutlined} from '@ant-design/icons';
import "./index.css"
const { Search } = Input;



export default class Item extends React.Component {
  state = {
    isShow:false, 
    isShow1:false,
    data : [
      {
        id: '01001',
        name: '联芯集成电路制造项目',
        area: '香港',
        stage: '续建',
        beginmonth:'2015-03-26',
        endmonth:'2019-03-26',
        reg:974436,
        com:'31.93%',
        time:'08-21',
        status:'审核通过'
      },
      {
        id: '01002',
        name: '联芯集成电路制造项目',
        area: '香港',
        stage: '续建',
        beginmonth:'2015-03-26',
        endmonth:'2019-03-26',
        reg:974436,
        com:'31.93%',
        time:'08-21',
        status:'审核通过'
      },
      {
        id: '01003',
        name: '联芯集成电路制造项目',
        area: '香港',
        stage: '续建',
        beginmonth:'2015-03-26',
        endmonth:'2019-03-26',
        reg:974436,
        com:'31.93%',
        time:'08-21',
        status:'审核通过'
      },,
      {
        id: '01004',
        name: '联芯集成电路制造项目',
        area: '香港',
        stage: '续建',
        beginmonth:'2015-03-26',
        endmonth:'2019-03-26',
        reg:974436,
        com:'31.93%',
        time:'08-21',
        status:'审核通过'
      },,
      {
        id: '01005',
        name: '联芯集成电路制造项目',
        area: '香港',
        stage: '续建',
        beginmonth:'2015-03-26',
        endmonth:'2019-03-26',
        reg:974436,
        com:'31.93%',
        time:'08-21',
        status:'审核通过'
      },,
      {
        id: '01006',
        name: '联芯集成电路制造项目',
        area: '香港',
        stage: '续建',
        beginmonth:'2015-03-26',
        endmonth:'2019-03-26',
        reg:974436,
        com:'31.93%',
        time:'08-21',
        status:'审核通过'
      },,
      {
        id: '01007',
        name: '联芯集成电路制造项目',
        area: '香港',
        stage: '续建',
        beginmonth:'2015-03-26',
        endmonth:'2019-03-26',
        reg:974436,
        com:'31.93%',
        time:'08-21',
        status:'审核通过'
      },
    ],
    columns:[
      {
        title: '项目编号',
        dataIndex: 'id',
        key: 'id'
      },
      {
        title: '用项目名称',
        dataIndex: 'name',
        key: 'name',
      },
      {
        title: '所在地区',
        dataIndex: 'area',
        key: 'area',
      },
      {
        title: '建设阶段',
        dataIndex: 'stage',
        key: 'stage',
      },
      {
        title: '开工年月',
        dataIndex: 'beginmonth',
        key: 'beginmonth',
      },
      {
        title: '完工年月',
        dataIndex: 'endmonth',
        key: 'endmonth',
      },
      {
        title: '总投资',
        dataIndex: 'reg',
        key: 'reg',
      },
      {
        title: '项目完成率',
        dataIndex: 'com',
        key: 'com',
      },
      {
        title: '更新时间',
        dataIndex: 'time',
        key: 'time',
      },
      {
        title: '状态',
        dataIndex: 'status',
        key: 'status',
      },
      {
        title: '操作',
        key: 'action',
        render: (text,record,index) => (
          <Space size="middle">
            <Button type="primary" onClick={()=>this.change(record,index)}>修改</Button>
            <Popconfirm placement="topRight" title="您真的要删除吗" onConfirm={()=>{this.delete(record.id,index)}} okText="Yes" cancelText="No">
              <Button>删除</Button>
            </Popconfirm>
            
          </Space>
        ),
      }
    ]
  }
  render = () => {
    return(
    <div>
        <Button type="primary" icon={<EditOutlined />} onClick={()=>this.add()}>添加</Button>
        <Search placeholder="搜索" onSearch={(value,event)=>{this.search(value,event)}} enterButton />
        <Table columns={this.state.columns} dataSource={this.state.data} />
  </div>
    
  )
}
}